import {ExtensionCategory, Graph, Line, Quadratic, register} from '@antv/g6';

class PathInLine extends Quadratic {
    onCreate() {
        const shape = this.shapeMap.key;
        const length = shape.getTotalLength();
        shape.animate([{ lineDash: [0, length] }, { lineDash: [length, 0] }], {
            duration: 500,
            fill: 'both',
        });
    }
}

function registerEdge() {
    register(ExtensionCategory.EDGE, 'path-in-line', PathInLine);
}

export default registerEdge;
